package _10_9;

import java.nio.charset.Charset;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Scanner;

public class Main {

    public static void displayMenu() {
	System.out.println("Language menu:");
	System.out.println("\t1)English:");
	System.out.println("\t2)Bulgarian");
	System.out.print("Enter your choice: ");
    }

    public static boolean isPalindrome(String word) {
	int length = word.length();

	for (int i = 0; i < length / 2; i++) {
	    if (word.charAt(i) != word.charAt(length - 1 - i)) {
		return false;
	    }
	}

	return true;
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
	try {
	    Locale locale;
	    ResourceBundle resource;
	    Scanner scanner = new Scanner(System.in);

	    displayMenu();
	    switch (scanner.nextInt()) {
	    default:
	    case 1:
		locale = Locale.US;
		break;
	    case 2:
		locale = new Locale("bg", "BG");
		break;
	    }

	    resource = ResourceBundle.getBundle("_10_9.resource", locale);
	    System.out.println(Charset.defaultCharset().name());
	    System.out.println(resource.getString("ENTER_TEXT"));
	    System.out.println(resource.getObject("ENTER_TEXT"));
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }
}
